#ifndef UDPTHREAD_H
#define UDPTHREAD_H

#include <QObject>
#include <QThread>
#include <QUdpSocket>

class UdpThread : public QThread
{
    Q_OBJECT
public:
    explicit UdpThread(QUdpSocket* udpsocket);
    void run() override; //重写运行函数
    void readPendingDatagrams();

    void writeTo(QByteArray message);

signals:
    void imgReturned(QImage *img);

private:
    QUdpSocket *m_udpsocket;
    QHostAddress m_sender;
    quint16 m_senderPort;

};

#endif // UDPTHREAD_H
